home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / sun / volume1 / tooltool2.1c / part03 < prev    next >
Encoding:
Internet Message Format  |  1989-06-06  |  47.7 KB

  1. Path: uunet!husc6!rutgers!aramis.rutgers.edu!dartagnan.rutgers.edu!mcgrew
  2. From: mcgrew@dartagnan.rutgers.edu (Charles Mcgrew)
  3. Newsgroups: comp.sources.sun
  4. Subject: v01i022:  Tooltool - a suntools user interface builder, Part 03/13
  5. Message-ID: <Jun.7.00.11.16.1989.23504@dartagnan.rutgers.edu>
  6. Date: 7 Jun 89 04:11:21 GMT
  7. Organization: Rutgers Univ., New Brunswick, N.J.
  8. Lines: 1364
  9. Approved: mcgrew@aramis.rutgers.edu
  10.  
  11. Submitted-by: Chuck Musciano <chuck@trantor.harris-atd.com>
  12. Posting-number: Volume 1, Issue 22
  13. Archive-name: tooltool2.1c/part03
  14.  
  15. #! /bin/sh
  16. # This is a shell archive.  Remove anything before this line, then unpack
  17. # it by saving it into a file and typing "sh file".  To overwrite existing
  18. # files, type "sh file -c".  You can also feed this as standard input via
  19. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  20. # will see the following message at the end:
  21. #        "End of archive 3 (of 13)."
  22. # Contents:  samples/keytool.l samples/keytool.r.14.uu
  23. #   samples/stopwatch.tt samples/vt100/newskeys.ras.uu
  24. #   samples/vt100/term.c tooltool.c
  25. # Wrapped by chuck@melmac on Thu Jun  1 10:39:28 1989
  26. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  27. if test -f 'samples/keytool.l' -a "${1}" != "-c" ; then 
  28.   echo shar: Will not clobber existing file \"'samples/keytool.l'\"
  29. else
  30. echo shar: Extracting \"'samples/keytool.l'\" \(6797 characters\)
  31. sed "s/^X//" >'samples/keytool.l' <<'END_OF_FILE'
  32. X.TH SETWIN 1 "8 December 1988"
  33. X.SH NAME
  34. Xkeytool \- terminal emulator with interactively redefineable function keys
  35. X.SH SYNOPSIS
  36. X\fBkeytool\fP [\fB\(hyi\fP \fIinit_file\fP] \fIcommand\fP [\fIargs\fP]
  37. X.SH DESCRIPTION
  38. X.LP
  39. X\f2Keytool\fP is an interactive terminal emulator built with \f2tooltool\fP(1).
  40. XIt provides a tty subwindow environment similar to \f2shelltool\fP(1) for executing
  41. Xinteractive commands.  This is very useful for running shell programs both locally
  42. X(such as \f2ssh\fP(1)) and remotely (using \f2rlogin\fP(1), or 
  43. X\f2telnet\fP(1). 
  44. X.LP
  45. X\f2Keytool\fP behaves very much like \f2shelltool\fP(1).
  46. XKeystrokes typed to \f2keytool\fP are passed to the program specified in \fIcommand\fP.
  47. X(\fICommand\fP must specify the full pathname of the program.)
  48. XIf this program is a shell, it accepts commands and runs programs in the usual way.
  49. XAny shelltool-like window arguments may be specified in \fIargs\fP.
  50. XThese are processed by tooltool and not sent to \fIcommand\fP. Any other \fIargs\fP
  51. Xare passed to the program.
  52. X.LP
  53. X\f2Keytool\fP accepts one command line option of its own, \fB\(hyi\fP, and this must be first
  54. Xin the command line. Its argument, \fIinit_file\fP, specifies the initial filename
  55. X\f2keytool\fP will read for function key definitions.  The default is 
  56. X~/.keytool if it exists, and /usr/local/lib/keytool.defaults if not.
  57. X.LP
  58. X\f2Keytool\fP allows definition of the function keys L2-L4, L9-L10, F1-F9, 
  59. Xand R1-R15 with any combinations of CONTROL, SHIFT, and META.  It also 
  60. Xallows definition of any shifted combinations of the three mouse buttons 
  61. Xexcept for one.  CONTROL-SHIFT-META-RIGHT_MOUSE brings up the \f2keytool\fP
  62. Xmenu that is described below.  The unshifted mouse buttons behave as in any
  63. Xtty subwindow: select, adjust, and tty subwindow menu.
  64. X.LP
  65. X\f2Keytool\fP has two complete sets of function key and mouse button 
  66. Xdefinitions designated \fBprimary\fP and \fBsecondary\fP.  These
  67. Xcould be used, for example, with one keyset for shell operation and the 
  68. Xother for an editor.
  69. XThe \f2keytool\fP menu has entries to select either as the active 
  70. Xkeyset. Also, pressing the CONTROL-SHIFT-META combination of any function 
  71. Xkey that is not otherwise bound will toggle the active keyset, annunciating
  72. Xa single beep if the primary keyset becomes active and a double beep for 
  73. Xthe secondary. 
  74. X.SH KEYTOOL MENU
  75. X.LP
  76. XThe \f2keytool\fP menu invoked by CONTROL-SHIFT-META-RIGHT_MOUSE contains 
  77. Xthese entries:
  78. X.IP "\f2Define Keys\fP"
  79. XBring up the \f2keytool\fP \fBkey definition window\fP, descibed below.
  80. X.IP "\f2Use Primary\fP"
  81. XDesignate the primary keyset as active.
  82. X.IP "\f2Use Secondary\fP"
  83. XDesignate the secondary keyset as active.
  84. X.IP "\f2Read Init File\fP"
  85. XRead the currently active initialization file, redefining all function 
  86. Xkey and mouse button combinations. 
  87. X.SH KEY DEFINITION WINDOW
  88. X.IP
  89. XThe \f2keytool\fP \fBkey definition window\fP allows any key to be 
  90. Xredefined for immediate use.  There is no need to edit ~/.keytool and 
  91. Xrestart the application (as with shelltool and .ttyswrc).  The key 
  92. Xdefinition window is activated from the \f2keytool\fP menu described above.
  93. XIt may be moved around and left open without affecting the operation of the
  94. Xapplication window. Thus key definitions can be used or tested out as soon 
  95. Xas they are typed in.
  96. X.IP "\f2Key Definition\fP"
  97. XThe text entry gadget in the bottom center of the window shows the current 
  98. Xdefinition for the selected key.  Directly to its left are choice gadgets 
  99. Xfor selecting the key and shift combination to be defined.  The definition 
  100. Xcan be replaced or altered with any printing or non-printing ascii 
  101. Xcharacters (except for the \fBline separator\fP and \fBitem separator\fP 
  102. Xcharacters described below). A special font is used so that control characters 
  103. Xare identifiable. Certain keys have special functions. TAB advances the 
  104. Xactive text gadget within the key definition window. CONTROL-U deletes the 
  105. Xentire line, and CONTROL-W deletes the last word. DELETE erase the last 
  106. Xcharacter. To enter one of these characters into a key definition, a 
  107. Xspecial button is provided to the right of the text entry gadget. 
  108. X.IP
  109. XMouse button definitions may have tooltool \fIformat\fP specifications for 
  110. Xup to two variables embedded in them. These will be replaced with the
  111. Xmouse cursor's X and Y character positions using 1,1 as the origin.
  112. XFor example, the definition "ESC5%c%c" will cause a mouse button to send 
  113. X"ESC5", followed by the character with the value of the cursor's X position, 
  114. Xfollowed by the character with the value of the cursor's Y position.
  115. X.IP "\f2Define Button\fP"
  116. XKey definitions do not take effect until the \fBdefine\fP button is 
  117. Xselected. If the active key is changed without doing so, the definition is 
  118. Xlost.
  119. X.IP "\f2Function Key Buttons\fP"
  120. XSurrounding the key definition window, there are buttons for each of the 
  121. Xdefinable function keys and the mouse buttons.  The active key for 
  122. Xdefinition can be specified by selecting one of these buttons with the 
  123. Xappropriate shift combination.
  124. X.IP "\f2Active Keyset\fP"
  125. XThis choice gadget allows selection of either the primary or secondary 
  126. Xkeyset for both definition and use.
  127. X.IP "\f2Definition File\fP"
  128. XThis text gadget specifies filename to save or read key definitions from.
  129. XThe entry may be edited in the normal way (CONTROL-W, CONTROL-U, and DELETE).
  130. XIt does filename completion when SPACE is pressed.
  131. X.IP "\f2Item Separator\fP"
  132. X.IP "\f2Line Separator\fP"
  133. XKey definitions may contain any ascii characters \f2except\fP for two. 
  134. X\f2Keytool\fP needs two special characters to separate definitions within 
  135. Xthe definition file.  The item and line separators may be specified as any
  136. Xascii characters that will not be used in key definitions.  The defaults 
  137. Xare TAB and NEWLINE, respectively.  As with the key definition gadget
  138. Xa button is provided next to the separator text gadget for entering TAB, 
  139. XCONTROL-U, CONTROL-W, or DELETE. Selecting the "\fISeparator\fP" text will 
  140. Xtoggle between the two character definition fields. 
  141. X.IP "\f2Save\fP"
  142. XThe \fBsave\fP button normally saves both keysets to the definition file. 
  143. XShift combinations also allow loading key definitions from a file, copying 
  144. Xeither keyset over the other, and setting the definition file gadget to the
  145. Xdefault filename (or the filename specified with the \fB\(hyi\fP command 
  146. Xline option). This last fuction does \f2not\fP load key definitions.
  147. X.IP "\f2Done\fP"
  148. XThe \fBdone\fP button removes the key definition window from the screen. It
  149. Xcan be reopened from the \f2keytool\fP menu.
  150. X.SH AUTHOR
  151. X.LP
  152. XKen Laprade
  153. X.SH FILES
  154. X.LP
  155. X.br
  156. X~/.keytool
  157. X.br
  158. X/usr/local/lib/keytool.defaults
  159. X.SH "SEE ALSO"
  160. X.LP
  161. Xshelltool (1),
  162. Xtooltool (1)
  163. X.SH BUGS
  164. X.LP
  165. XDue to the size of the file  that \f2tooltool\fP(1) must parse, 
  166. X\f2keytool\fP takes an obnoxiously long time to start up.
  167. X
  168. END_OF_FILE
  169. if test 6797 -ne `wc -c <'samples/keytool.l'`; then
  170.     echo shar: \"'samples/keytool.l'\" unpacked with wrong size!
  171. fi
  172. # end of 'samples/keytool.l'
  173. fi
  174. if test -f 'samples/keytool.r.14.uu' -a "${1}" != "-c" ; then 
  175.   echo shar: Will not clobber existing file \"'samples/keytool.r.14.uu'\"
  176. else
  177. echo shar: Extracting \"'samples/keytool.r.14.uu'\" \(6527 characters\)
  178. sed "s/^X//" >'samples/keytool.r.14.uu' <<'END_OF_FILE'
  179. Xbegin 666 keytool.r.14
  180. XM 1X(8  ( !       ! +!0 (  @ $  0"P4 "  ( "  $ L%  @ "  P ! +
  181. XM!0 (  @ 0  0"P4 "  ( %  $ L%  @ " !@ ! +!0 (  @ <  0"P4 "  (
  182. XM (  $ L%  @ " "0 ! +!0 (  @ H  0"P4 "  ( +  $ L%  @ " #  ! +
  183. XM!0 (  @ T  0"P4 "  ( .  $ L%  @ " #P ! +!0 (  @!   0"P4 "  (
  184. XM 1  $ L%  @ " $@ ! +!0 (  @!,  0"P4 "  ( 4  $ L%  @ " %0 ! +
  185. XM!0 (  @!8  0"P4 "  ( 7  $ L%  @ " &  ! +!0 (  @!D  0"P4 "  (
  186. XM :  $ L%  @ " &P ! +!0 (  @!P  0"P4 "  ( =  $ L%  @ " '@ ! +
  187. XM!0 (  @!\  0"P4 "  ( @  $ L%  @ " (0 ! +!0 (  @"(  0"P4 "  (
  188. XM C  $ L%  @ " )  ! +!0 (  @"4  0"P4 "  ( F  $ L%  @ " )P ! +
  189. XM!0 (  @"@  0"P4 "  ( I  $ L%  @ " *@ ! +!0 (  @"L  0"P4 "  (
  190. XM L  $ L%  @ " +0 ! +!0 (  @"X  0"P4 "  ( O  $ L%  @ " ,  ! +
  191. XM!0 (  @#$  0"P4 "  ( R  $ L%  @ " ,P ! +!0 (  @#0  0"P4 "  (
  192. XM U  $ L%  @ " -@ ! +!0 (  @#<  0"P4 "  ( X  $ L%  @ " .0 ! +
  193. XM!0 (  @#H  0"P4 "  ( [  $ L%  @ " /  ! +!0 (  @#T  0"P4 "  (
  194. XM ^  $ L%  @ " /P ! +!0 (  @$   0"P4 "  (!!  $ L%  @ " 0@ ! +
  195. XM!0 (  @$,  0"P4 "  (!$  $ L%  @ " 10 ! +!0 (  @$8  0"P4 "  (
  196. XM!'  $ L%  @ " 2  ! +!0 (  @$D  0"P4 "  (!*  $ L%  @ " 2P ! +
  197. XM!0 (  @$P  0"P4 "  (!-  $ L%  @ " 3@ ! +!0 (  @$\  0"P4 "  (
  198. XM!0  $ L%  @ " 40 ! +!0 (  @%(  0"P4 "  (!3  $ L%  @ " 5  ! +
  199. XM!0 (  @%4  0"P4 "  (!6  $ L%  @ " 5P ! +!0 (  @%@  0"P4 "  (
  200. XM!9  $ L%  @ " 6@ ! +!0 (  @%L  0"P4 "  (!<  $ L%  @ " 70 ! +
  201. XM!0 (  @%X  0"P4 "  (!?  $ L%  @ " 8  ! +!0 (  @&$  0"P4 "  (
  202. XM!B  $ L%  @ " 8P ! +!0 (  @&0  0"P4 "  (!E  $ L%  @ " 9@ ! +
  203. XM!0 (  @&<  0"P4 "  (!H  $ L%  @ " :0 ! +!0 (  @&H  0"P4 "  (
  204. XM!K  $ L%  @ " ;  ! +!0 (  @&T  0"P4 "  (!N  $ L%  @ " ;P ! +
  205. XM!0 (  @'   0"P4 "  (!Q  $ L%  @ " <@ ! +!0 (  @',  0"P4 "  (
  206. XM!T  $ L%  @ " =0 ! +!0 (  @'8  0"P4 "  (!W  $ L%  @ " >  ! +
  207. XM!0 (  @'D  0"P4 "  (!Z  $ L%  @ " >P ! +!0 (  @'P  0"P4 "  (
  208. XM!]  $ L%  @ " ?@ ! +!0 (  @'\  0"P4 "  ("   $ L%  @ " @0 ! +
  209. XM!0 (  @((  0"P4 "  ("#  $ L%  @ " A  ! +!0 (  @(4  0"P4 "  (
  210. XM                                                            
  211. XM                                                            
  212. XM                                                            
  213. XM                                                            
  214. XM                                                            
  215. XM                                                            
  216. XM                                                            
  217. XM                                                            
  218. XM                                                            
  219. XM                                                            
  220. XM                                                            
  221. XM                                                            
  222. XM                                                            
  223. XM                                                            
  224. XM                                                            
  225. XM                                                            
  226. XM                                                            
  227. XM                                                            
  228. XM                                                            
  229. XM                                                            
  230. XM                                                            
  231. XM                                                            
  232. XM                                                            
  233. XM                                                            
  234. XM                                                            
  235. XM                                                            
  236. XM                                                            
  237. XM            3[ 7%1<1#P            !&J0D)#PD)            3JD)
  238. XM#PD)#@           $:I" @("08           !.J0D)"0D.            
  239. XM3Z@(#@@(#P           $^H" X(" @           !&J0@+"0D'        
  240. XM    2:D)#PD)"0    #@0$! 4"@X*"@&!0<%!P   )#0T+"PD  (" @(" \ 
  241. XM        2:L.# H+"0           $BH" @(" \      &"0@("08  ."0D.
  242. XM"0D         2:D-#0L+"0           $:I"0D)"08           !.J0D.
  243. XM" @(            1JD)"0D-!@$          $ZI"0X*"0D           !&
  244. XMJ0@& 0D&            7Z0$! 0$!            $FI"0D)"08         
  245. XM  !1L0H*"@0$            4;45%145"@           %&J"@0*"A$     
  246. XM      !1J@H$! 0$            3Z$#!@P(#P    #@@." X#@@. @X!@@(
  247. XM" 8       !(J 0$ @(!            3J(" @("#@           $2J    
  248. XM              ! H      ?                             ! 0$! 0
  249. XM$!   !         D)"0D                $A(2?R0D_DA(2       $#A4
  250. XM5% P&!145#@0      !DE)AH$! L,E),        ,$A(,"!2C(B89@      
  251. XM  @($"                0($! @(" @(! 0" 0    @$ @(! 0$! 0("! @
  252. XM       05#@X5!               ! 0$/X0$!                     8
  253. XM& @0(           ?@                       !@8       "! 0("! 0
  254. XM("! 0(       #Q"0D9*4F)"0CP        (&"@(" @(" @^        /$)"
  255. XM @0($"! ?@       #Q"0@(< @)"0CP        $#!0D1(3^! 0$        
  256. XM?D! 0'P" D)"/        #Q"0$!\0D)"0CP       !^0@($! @($! 0    
  257. XM    /$)"0CQ"0D)"/        #Q"0D)"/@("0CP            8&    !@8
  258. XM            &!@    8& @0(    @0($"! (! (! (           !^    
  259. XM?@        ! (! (! ($"! @0        #Q"0@($" @   @        8)$).
  260. XM4E),0"(<        &!@8)"0D0GY"0@       'A$1$1X1$)"0GP        \
  261. XM0D) 0$! 0D(\        >$1"0D)"0D)$>        'Y 0$!\0$! 0'X     
  262. XM  !^0$! ?$! 0$!         /$)"0$!.0D)&.@       $)"0D)^0D)"0D( 
  263. XM      !\$! 0$! 0$!!\        '@0$! 0$!$1$.        $)$2%!@<%A,
  264. XM1D(       ! 0$! 0$! 0$!^        @H+&QJJJDI*"@@       $)B8E)2
  265. XM2DI&1D(        \0D)"0D)"0D(\        ?$)"0D)\0$! 0        #Q"
  266. XM0D)"0D)"0CP0" 8   !\0D)"?$A$1$)"        /$)"(!@$ D)"/       
  267. XM /X0$! 0$! 0$!        !"0D)"0D)"0D(\        0D)"0B0D)!@8&   
  268. XM     (*"@I)45%0H*"@       !"0B0D&!@D)$)"        @H)$1"@0$! 0
  269. XM$        'X" @0($"! 0'X      #P@(" @(" @(" @(#P   " 0$ @(! 0
  270. XM" @$! (     / 0$! 0$! 0$! 0$/       &"1"                    
  271. XM         /X      " @$ @                    X1 0\1$0Z        
  272. XM0$! 7&)"0D)B7            #Q"0$! 0CP        " @(Z1D)"0D8Z    
  273. XM        /$)"?D!"/         P2$!!\$! 0$!             Z1D)"0D8Z
  274. XM D(\    0$! 7&)"0D)"0@        @( #@(" @(" @        $!  <! 0$
  275. XM! 0$!$0X    0$! 1$A0<$A$0@       #@(" @(" @(" @           #L
  276. XMDI*2DI*2            7&)"0D)"0@           #Q"0D)"0CP         
  277. XM  !<8D)"0F)<0$! 0       .D9"0D)&.@(" @(      %QB0$! 0$      
  278. XM       \0D \ D(\        $! 0?! 0$! 2#            $)"0D)"1CH 
  279. XM          !"0D(D)!@8            @H*2DI*2;            $)")!@D
  280. XM0D(           !"0B(D%!0("!!0(       ?@0($"! ?@      #A 0$! 0
  281. XM8! 0$! 0#@   ! 0$! 0$  0$! 0$!    !P" @(" @&" @(" AP       R
  282. XM6DP              ."0D."0D  &"0D)"08                         
  283. XM                                                            
  284. XB                                                
  285. Xend
  286. END_OF_FILE
  287. if test 6527 -ne `wc -c <'samples/keytool.r.14.uu'`; then
  288.     echo shar: \"'samples/keytool.r.14.uu'\" unpacked with wrong size!
  289. fi
  290. # end of 'samples/keytool.r.14.uu'
  291. fi
  292. if test -f 'samples/stopwatch.tt' -a "${1}" != "-c" ; then 
  293.   echo shar: Will not clobber existing file \"'samples/stopwatch.tt'\"
  294. else
  295. echo shar: Extracting \"'samples/stopwatch.tt'\" \(7891 characters\)
  296. sed "s/^X//" >'samples/stopwatch.tt' <<'END_OF_FILE'
  297. X#define        update_display(t)    { tenths     = t[0]; \
  298. X                      second_one = t[1]; \
  299. X                      second_ten = t[2]; \
  300. X                      minute_one = t[3]; \
  301. X                      minute_ten = t[4]; \
  302. X                      hour_one   = t[5]; \
  303. X                      hour_ten   = t[6]; \
  304. X                    }
  305. X
  306. X#define        set_time(t)        { t[0] = tenths; \
  307. X                      t[1] = second_one; \
  308. X                      t[2] = second_ten; \
  309. X                      t[3] = minute_one; \
  310. X                      t[4] = minute_ten; \
  311. X                      t[5] = hour_one; \
  312. X                      t[6] = hour_ten; \
  313. X                    }
  314. X
  315. X#define        inc_time(a,b,c,d,e,f,g)    { if (by_seconds) \
  316. X                         b = ++time[1]; \
  317. X                      else if ((a = ++time[0]) > 9) { \
  318. X                         a = time[0] = 0; \
  319. X                         b = ++time[1]; \
  320. X                         } \
  321. X                      if (time[1] > 9) { \
  322. X                         b = time[1] = 0; \
  323. X                         if ((c = ++time[2]) > 5) { \
  324. X                             c = time[2] = 0; \
  325. X                             if ((d = ++time[3]) > 9) { \
  326. X                                d = time[3] = 0; \
  327. X                                if ((e = ++time[4]) > 5) { \
  328. X                                   e = time[4] = 0; \
  329. X                                   if ((f = ++time[5]) > 9) { \
  330. X                                      f = time[5] = 0; \
  331. X                                      if ((g = ++time[6]) > 9) \
  332. X                                        g = time[6] = 0; \
  333. X                                     } \
  334. X                                  } \
  335. X                               } \
  336. X                            } \
  337. X                         } \
  338. X                    }
  339. X
  340. X#define        dec_time(a,b,c,d,e,f,g)    { if (by_seconds) \
  341. X                         b = --time[1]; \
  342. X                      else if ((a = --time[0]) < 0) { \
  343. X                         a = time[0] = 9; \
  344. X                         b = --time[1]; \
  345. X                         } \
  346. X                      if (time[1] < 0) { \
  347. X                         b = time[1] = 9; \
  348. X                         if ((c = --time[2]) < 0) { \
  349. X                             c = time[2] = 5; \
  350. X                             if ((d = --time[3]) < 0) { \
  351. X                                d = time[3] = 9; \
  352. X                                if ((e = --time[4]) < 0) { \
  353. X                                   e = time[4] = 5; \
  354. X                                   if ((f = --time[5]) < 0) { \
  355. X                                      f = time[5] = 9; \
  356. X                                      if ((g = --time[6]) < 0) \
  357. X                                        g = time[6] = 9; \
  358. X                                     } \
  359. X                                  } \
  360. X                               } \
  361. X                            } \
  362. X                         } \
  363. X                    }
  364. X
  365. X#define        TINY_FONT    "/usr/lib/fonts/fixedwidthfonts/screen.r.7"
  366. X#define        MEDIUM_FONT    "/usr/lib/fonts/fixedwidthfonts/screen.b.14"
  367. X#define        BIG_FONT    "/usr/lib/fonts/fixedwidthfonts/gallant.r.19"
  368. X
  369. X#define        TRUE        1
  370. X#define        FALSE        0
  371. X
  372. X#define        ROW_1        4
  373. X#define        ROW_2        17
  374. X#define        ROW_3        39
  375. X
  376. Xapplication ""
  377. X   size 0 by 200 pixels
  378. X   label "  << Stopwatch >>"
  379. X   icon "stopwatch.icon"
  380. X   initialize {
  381. X      remove split_button;
  382. X      remove resume_button;
  383. X      remove stop_button;
  384. X      display start_button;
  385. X      display reset_button;
  386. X      remove split_light;
  387. X      in_split = FALSE;
  388. X      time = tokenize("0 0 0 0 0 0 0");
  389. X      }
  390. X
  391. X   timer {
  392. X      if (count_down) {
  393. X         if (in_split)
  394. X            dec_time(d,d,d,d,d,d,d)
  395. X         else
  396. X            dec_time(tenths, second_one, second_ten, minute_one, minute_ten, hour_one, hour_ten);
  397. X         if (time == "0 0 0 0 0 0 0") {
  398. X            interval = 0;
  399. X            beep;
  400. X            beep;
  401. X            beep;
  402. X            remove stop_button;
  403. X            remove split_button;
  404. X            display start_button;
  405. X            if (!in_split)
  406. X               display reset_button;
  407. X            }
  408. X         }
  409. X      else if (in_split)
  410. X         inc_time(d,d,d,d,d,d,d)
  411. X      else
  412. X         inc_time(tenths, second_one, second_ten, minute_one, minute_ten, hour_one, hour_ten);
  413. X      }
  414. X
  415. Xgadgets
  416. X   font MEDIUM_FONT
  417. X   choice count_down
  418. X      at 4 ROW_1
  419. X      display current
  420. X      "Up" : TINY_FONT    nothing;
  421. X      "Down": TINY_FONT    nothing;
  422. X   end_choice
  423. X   label split_light
  424. X      at 61 ROW_1
  425. X      "Split" : TINY_FONT
  426. X   end_label
  427. X   choice by_seconds
  428. X      at 110 ROW_1
  429. X      display current
  430. X      "0.1 sec" : TINY_FONT {
  431. X         display decimal_point;
  432. X         display tenths;
  433. X         if (interval > 0)
  434. X            interval = 0.1;
  435. X         }
  436. X      "  1 sec" : TINY_FONT {
  437. X         remove decimal_point;
  438. X         remove tenths;
  439. X         tenths = time[0] = 0;
  440. X         if (interval > 0)
  441. X            interval = 1;
  442. X         }
  443. X   end_choice
  444. X   choice hour_ten
  445. X      at 16 ROW_2
  446. X      display current
  447. X      "0" : BIG_FONT        nothing;
  448. X      "1" : BIG_FONT        nothing;
  449. X      "2" : BIG_FONT        nothing;
  450. X      "3" : BIG_FONT        nothing;
  451. X      "4" : BIG_FONT        nothing;
  452. X      "5" : BIG_FONT        nothing;
  453. X      "6" : BIG_FONT        nothing;
  454. X      "7" : BIG_FONT        nothing;
  455. X      "8" : BIG_FONT        nothing;
  456. X      "9" : BIG_FONT        nothing;
  457. X   end_choice
  458. X   choice hour_one
  459. X      at 28 ROW_2
  460. X      display current
  461. X      "0" : BIG_FONT        nothing;
  462. X      "1" : BIG_FONT        nothing;
  463. X      "2" : BIG_FONT        nothing;
  464. X      "3" : BIG_FONT        nothing;
  465. X      "4" : BIG_FONT        nothing;
  466. X      "5" : BIG_FONT        nothing;
  467. X      "6" : BIG_FONT        nothing;
  468. X      "7" : BIG_FONT        nothing;
  469. X      "8" : BIG_FONT        nothing;
  470. X      "9" : BIG_FONT        nothing;
  471. X   end_choice
  472. X   label
  473. X      at 40 ROW_2
  474. X      ":" : BIG_FONT
  475. X   end_label
  476. X   choice minute_ten
  477. X      at 52 ROW_2
  478. X      display current
  479. X      "0" : BIG_FONT        nothing;
  480. X      "1" : BIG_FONT        nothing;
  481. X      "2" : BIG_FONT        nothing;
  482. X      "3" : BIG_FONT        nothing;
  483. X      "4" : BIG_FONT        nothing;
  484. X      "5" : BIG_FONT        nothing;
  485. X   end_choice
  486. X   choice minute_one
  487. X      at 64 ROW_2
  488. X      display current
  489. X      "0" : BIG_FONT        nothing;
  490. X      "1" : BIG_FONT        nothing;
  491. X      "2" : BIG_FONT        nothing;
  492. X      "3" : BIG_FONT        nothing;
  493. X      "4" : BIG_FONT        nothing;
  494. X      "5" : BIG_FONT        nothing;
  495. X      "6" : BIG_FONT        nothing;
  496. X      "7" : BIG_FONT        nothing;
  497. X      "8" : BIG_FONT        nothing;
  498. X      "9" : BIG_FONT        nothing;
  499. X   end_choice
  500. X   label
  501. X      at 76 ROW_2
  502. X      ":" : BIG_FONT
  503. X   end_label
  504. X   choice second_ten
  505. X      at 88 ROW_2
  506. X      display current
  507. X      "0" : BIG_FONT        nothing;
  508. X      "1" : BIG_FONT        nothing;
  509. X      "2" : BIG_FONT        nothing;
  510. X      "3" : BIG_FONT        nothing;
  511. X      "4" : BIG_FONT        nothing;
  512. X      "5" : BIG_FONT        nothing;
  513. X   end_choice
  514. X   choice second_one
  515. X      at 100 ROW_2
  516. X      display current
  517. X      "0" : BIG_FONT        nothing;
  518. X      "1" : BIG_FONT        nothing;
  519. X      "2" : BIG_FONT        nothing;
  520. X      "3" : BIG_FONT        nothing;
  521. X      "4" : BIG_FONT        nothing;
  522. X      "5" : BIG_FONT        nothing;
  523. X      "6" : BIG_FONT        nothing;
  524. X      "7" : BIG_FONT        nothing;
  525. X      "8" : BIG_FONT        nothing;
  526. X      "9" : BIG_FONT        nothing;
  527. X   end_choice
  528. X   label decimal_point
  529. X      at 112 ROW_2
  530. X      "." : BIG_FONT
  531. X   end_label
  532. X   choice tenths
  533. X      at 124 ROW_2
  534. X      display current
  535. X      "0" : BIG_FONT        nothing;
  536. X      "1" : BIG_FONT        nothing;
  537. X      "2" : BIG_FONT        nothing;
  538. X      "3" : BIG_FONT        nothing;
  539. X      "4" : BIG_FONT        nothing;
  540. X      "5" : BIG_FONT        nothing;
  541. X      "6" : BIG_FONT        nothing;
  542. X      "7" : BIG_FONT        nothing;
  543. X      "8" : BIG_FONT        nothing;
  544. X      "9" : BIG_FONT        nothing;
  545. X   end_choice
  546. X   button start_button
  547. X      at 4 ROW_3
  548. X      normal "Start" {
  549. X         interval = by_seconds? 1 : 0.1;
  550. X         if (!in_split)
  551. X            set_time(time);
  552. X         remove start_button;
  553. X         remove reset_button;
  554. X         display stop_button;
  555. X         if (!in_split)
  556. X            display split_button;
  557. X         }
  558. X   end_button
  559. X   button stop_button
  560. X      at 4 ROW_3
  561. X      normal "Stop" {
  562. X         interval = 0;
  563. X         remove stop_button;
  564. X         remove split_button;
  565. X         display start_button;
  566. X         if (!in_split)
  567. X            display reset_button;
  568. X         }
  569. X   end_button
  570. X   button split_button
  571. X      at 91 ROW_3
  572. X      normal "Split" {
  573. X         in_split = TRUE;
  574. X         remove split_button;
  575. X         display resume_button;
  576. X         display split_light;
  577. X         }
  578. X   end_button
  579. X   button resume_button
  580. X      at 91 ROW_3
  581. X      normal "Resume" {
  582. X         in_split = FALSE;
  583. X         remove resume_button;
  584. X         remove split_light;
  585. X         update_display(time);
  586. X         if (interval > 0)
  587. X            display split_button;
  588. X         else
  589. X            display reset_button;
  590. X         }
  591. X   end_button
  592. X   button reset_button
  593. X      at 91 ROW_3
  594. X      normal "Reset" {
  595. X         time = tokenize("0 0 0 0 0 0 0");
  596. X         update_display(time);
  597. X         }
  598. X   end_button
  599. Xend_gadgets
  600. END_OF_FILE
  601. if test 7891 -ne `wc -c <'samples/stopwatch.tt'`; then
  602.     echo shar: \"'samples/stopwatch.tt'\" unpacked with wrong size!
  603. fi
  604. # end of 'samples/stopwatch.tt'
  605. fi
  606. if test -f 'samples/vt100/newskeys.ras.uu' -a "${1}" != "-c" ; then 
  607.   echo shar: Will not clobber existing file \"'samples/vt100/newskeys.ras.uu'\"
  608. else
  609. echo shar: Extracting \"'samples/vt100/newskeys.ras.uu'\" \(7089 characters\)
  610. sed "s/^X//" >'samples/vt100/newskeys.ras.uu' <<'END_OF_FILE'
  611. Xbegin 644 newskeys.ras
  612. XM6:9JE0   28   "&     0  $^0    !                            
  613. XM                                                            
  614. XM                        '________________________     !_____
  615. XM____________X  0     $     $     $     $     $     $     $  
  616. XM   0 !      0     0     0     0     0     0     0    !  $   
  617. XM  !     !     !           !     !     !     $  0,,0< $2>0< $
  618. XM,1.< $,1",<<     $,>,<,$<>,.,$<><>,0 !!))!( 1)!!( 1)(1( 1)(1
  619. XM))(     1)!))(1)!(1(1)!)!)  $$$D$@!'G$$@!"%!$@!"%!$$D@    !"
  620. XM'$DD!$G$!"!$G$G$$  06202 $200< $$<$< $$<(6<<     $$0><0$<06$
  621. XM$$20<060 !!))!( 1)!!  1)(1  1)(A)1      1)!)1(11!(1(1)!1!)  
  622. XM$##'G !$GGD !#$3D !#$4#$D     !#'DDC!$GC#C!''DGC$  0     $  
  623. XM   $     $           $     $     $     0 !      0     0     
  624. XM0     0     0     0     0    !  $     !     !     !     !   
  625. XM  !     !     !     $  0     $     $     $     $     $     $
  626. XM     $     0 !      0     0     0     0     0     0     0   
  627. XM !  $     !     !     !     !     !     !     !     $  0    
  628. XM $     $     $           $     $     $     0 !      0     0 
  629. XM    0Q$)XQ    P(      0     0    !  $     !     !     !$DA$$
  630. XMD CC!#B     !     !     $  0     $     $     $(4$<20$22$2$  
  631. XM   $     $     0 !      0     0     01PA!) M)(1)H     0     
  632. XM0    !  $     !     !     !$DB$$D!#DA$A     !     !     $  0
  633. XM     $     $     $,100,>"",$.(     $     $     0 !      0   
  634. XM  0     0      !P         0     0    !  $     !     !     ! 
  635. XM    !     !     !     !     $  0     $     $     $     $    
  636. XM $     $     $     0 !      0     0     0     0     0     0 
  637. XM    0    !  '________________________     !_________________
  638. XM\  0     $     $     $     $     $     $     $     0 !      
  639. XM0     0     0     0     0     0     0    !  $     !     !   
  640. XM  !     !     !     !     !     $  0<.<  $<"1>1$<"<>,$<",00$
  641. XM     $,>0>,$2< $,$<, $,0 !!(1(  1(1E!$1(1)!(1(1)! 0     1)!!
  642. XM!(1)( Q(1)( Q)  $$A$@ !$A%7%1$A$G$!$A$D$!     !"'$'$!$D@!#!$
  643. XMD@!#$  02$<  $2(305$2(<06$2(>00$     $$0000$2< $2$22 $20 !!(
  644. XM10  1(A%!L1(A1!(1(A)! 0     1)!!!(1)  1(1)( 1)  $'#D@ !'$$7D
  645. XM1'$$GC!'$$GGA     !#'GGC!#$ #C!'# #C$  0     $     $     $  
  646. XM   $     $     $     $     0 !      0     0     0     0     
  647. XM0     0     0    !  $     !     !     !     !     !     !   
  648. XM  !     $  0     $     $     $     $     $     $     $     0
  649. XM !      0     0     0     0     0     0     0    !  $     ! 
  650. XM    !     !     !     !     !     !     $  0     $     $    
  651. XM $     $     $     $     $     0 !!QPY%\1Y%]P 1Y$(Q 1Y$(QP0 
  652. XM  P(      1\QP  1PQ]]%  $$DA&1!$"A$@!$"A$D!$"A$DA CC!#B     
  653. XM!!$D@ !$DA!&T  022$5$$<$$2 $<$$20$<$$22$$22$2$     $$22  $<2
  654. XM$$50 !!QP1,01 H1P 1 HAY 1 HAYP0M)(1)H     01)P  1)(015  $$%!
  655. XM$1!$$1% !$$2$D!$$2$D!!#DA$A     !!$D  !$DA!$4  002.1$$>1$2 $
  656. XM>102>$>1020$"",$.(     $$,0  $<,$$10 !      0     0     0   
  657. XM  0!P         0     0    !  $     !     !     !     !     ! 
  658. XM    !     !     $  0     $     $     $     $     $     $    
  659. XM $     0 !      0     0     0     0     0     0     0    !  
  660. XM'________________________     !_________________\  0     $  
  661. XM   $     $     $                         !      0     0     
  662. XM0     0                         $'#G  ! $G  !' G'C!' C$$!   
  663. XM                       02$2  $(22" $2$202$2$200$            
  664. XM             !!(1(  01)(0 1(1)Q 1(1)! 0                     
  665. XM    $$A'  ! DG" !$B'$%A$B'D$!                          02$4 
  666. XM $$20$ $2(402$2(200$                         !!PY(  0@Q ( 1Q
  667. XM!)XP1Q!)YX0                         $     !     !     !     
  668. XM!                          0     $     $     $     $        
  669. XM                 !      0     0     0     0                 
  670. XM        $     !     !     !     !                          0
  671. XM     $     $     $     $                         !      0   
  672. XM        0     0                         $     !''@G#'     ! 
  673. XM    !   # @                    0     $20$222     $     $".,$
  674. XM.                    !      1)P1))(     0     01)(1(        
  675. XM            $     !'$"''G     !     !"TDA$@                 
  676. XM   0     $40(024     $     $$.2$2                    !      
  677. XM1)Y!!)(     0     0((P0X                    $     !         
  678. XM  !     ! '                        0     $     $     $     $
  679. XM                         !      0     0     0     0         
  680. XM                '________________________                   
  681. XM       0     $     $     $     $                         !  
  682. XM    0     0     0     0                         $     !     
  683. XM!     !                                0<>,< $ <,  $<"1>1$ >
  684. XM (                           !!)!)( 0A)(( 1(1E H0!!1XQ0     
  685. XM                    $$G$D@!!$DA !$A%7!! '&B$F@              
  686. XM           0<0>2 $"22( $<(30*$ 02(<0                        
  687. XM !!1!)( 01)(0 10A%!$0!!(A!                          $$GDG !"
  688. XM'# @!$D$7D1 'DACD                          0     $     $    
  689. XM $                               !      0     0     0     0 
  690. XM                        $     !     !     !     !           
  691. XM               0     $     $     $     $                    
  692. XM     !      0     0     0     0                         $   
  693. XM  !     !           !                          0           $
  694. XM           $                         !!QX))XP     1P)$ )(   
  695. XM  0   P(                    $$D!$D$@    !$A&41$@    ! CC!#@ 
  696. XM                   02<$><2     $2$5*$>     $$22$2           
  697. XM         !!Q A)!X     1PA,0A(     0M)(1(                    
  698. XM$%$"$D$@    !%"$2B$@    !!#DA$@                    02>02>2  
  699. XM   $201102     $"",$.                    !            0     
  700. XM      0!P                       $     !     !     !     !   
  701. XM                       0     $     $     $     $            
  702. XM             !________________________P                     
  703. XM    $     !     !     !                                0    
  704. XM $     $     $                               !      0     0 
  705. XM    0                               $     !     !     !     
  706. XM                           0     $     $                    
  707. XM                 !!P)$  0     1P)$ )X                       
  708. XM        $$A&40!     !$A&41$                                0
  709. XM2$51 $     $2$51$<                               !!PA-4 0   
  710. XM  1PA-4A                                $%"$50!     !%"$52$ 
  711. XM                               0201* $     $201*00          
  712. XM                     !      0     0     0                   
  713. XM            $     !     !     !                             
  714. XM   0     $     $     $                               !      
  715. XM0     0     0                               $           !   
  716. XM                                   0<"1 "2     $<"1 ">"2    
  717. XM   ,"                    !!(1E$1(     1(1E$1 1(    (XP0X    
  718. XM                $$A%41'@    !$A%41'!'@   !$DA$@             
  719. XM       0<(35(2     $<(35(0(2    +22$2                    !!0
  720. XMA%4A(     10A%4A A(    0Y(1(                    $$D$2D$@    
  721. XM!$D$2D$$$@    @C!#@                    0           $        
  722. XM     <                       !      0     0     0           
  723. XM                    $     !     !     !                     
  724. XM           ?_____\     '_____\                              
  725. XG                                                    
  726. Xend
  727. END_OF_FILE
  728. if test 7089 -ne `wc -c <'samples/vt100/newskeys.ras.uu'`; then
  729.     echo shar: \"'samples/vt100/newskeys.ras.uu'\" unpacked with wrong size!
  730. fi
  731. # end of 'samples/vt100/newskeys.ras.uu'
  732. fi
  733. if test -f 'samples/vt100/term.c' -a "${1}" != "-c" ; then 
  734.   echo shar: Will not clobber existing file \"'samples/vt100/term.c'\"
  735. else
  736. echo shar: Extracting \"'samples/vt100/term.c'\" \(8436 characters\)
  737. sed "s/^X//" >'samples/vt100/term.c' <<'END_OF_FILE'
  738. X /*
  739. X * vtem - A termcap driven VT100 emulator for BSD Unix
  740. X *
  741. X * $Header: /home/src/local/vttool/RCS/term.c,v 1.2 89/02/08 16:04:37 jqj Exp $
  742. X *
  743. X * $Log:    term.c,v $
  744. X * Revision 1.2  89/02/08  16:04:37  jqj
  745. X * 1/ set vttype to indicate what type of termianl (VT52, VT100, or VT102)
  746. X *    we can support
  747. X * 2/ don't do standout on terminals with standout glitches
  748. X * 3/ use appropriate padding on output
  749. X * 4/ clear to beginning of line must clear cursor too
  750. X * 5/ support for insert/delete character
  751. X * 6/ use "sr" rather than "up" to perform an upline-with-scroll.  The spec.
  752. X *    is unclear, but most existing termcap entries seem to work that way.
  753. X * 
  754. X * Version 1.1
  755. X *
  756. X * Public domain software.
  757. X * Written by Leif Samuelsson (leif@erisun) in December, 1985
  758. X */
  759. X
  760. X
  761. X/* This module contains termcap and tty routines */
  762. X
  763. X#include "vtem.h"
  764. X
  765. Xextern char *tgetstr(), *tgoto();
  766. X
  767. Xenum vt_terminal vttype;    /* the most powerful terminal we can support */
  768. X
  769. X/* Variables for saving original terminal parameters */
  770. Xstruct sgttyb oldb, newb;
  771. Xstruct tchars oldtchars, newtchars = { -1, -1, -1, -1, -1, -1 };
  772. Xstruct ltchars oldltchars, newltchars = { -1, -1, -1, -1, -1, -1 };
  773. Xint oldlb, newlb, oldl, newl;
  774. X
  775. X/* Terminal attributes */
  776. Xchar tbuf[1024];
  777. XBool BS;
  778. Xint CO, LI;
  779. Xchar    *AL, *BC, *BL, *CB, *CD, *CL, *CE, *CM, *CR, *CS, *DC, *DL, 
  780. X    *DO, *EI, *IC, *IM,
  781. X    *KE, *KS, *MB, *MD, *ME, *MR, *ND, *NL, *SE, *SO, *SR,
  782. X    *TI, *TE, *UE, *UP, *US, *MAL, *MDL;
  783. X
  784. X/* putchar() is (usually) just a macro, so... */ 
  785. Xputchar_x(c)
  786. Xchar c;
  787. X{
  788. X    putchar(c);
  789. X}
  790. X
  791. Xttycbreak()
  792. X{
  793. X    ioctl(0, TIOCGETP, &oldb);
  794. X    ioctl(0, TIOCGETC, &oldtchars);
  795. X    ioctl(0, TIOCGETD, &oldl);
  796. X    ioctl(0, TIOCGLTC, &oldltchars);
  797. X    ioctl(0, TIOCLGET, &oldlb);
  798. X
  799. X    newb = oldb;
  800. X    newb.sg_flags |= CBREAK;
  801. X    newb.sg_flags &= ~(CRMOD | ECHO);
  802. X    ioctl(0, TIOCSETP, &newb);
  803. X    ioctl(0, TIOCSETC, &newtchars);
  804. X    ioctl(0, TIOCSLTC, &newltchars);
  805. X    signal(SIGINT,SIG_IGN);
  806. X}
  807. X
  808. X
  809. X/* gettermtype - Finds terminal type and reads termcap entry for it.
  810. X */
  811. Xgettermtype()
  812. X{
  813. Xchar tptr[1024];
  814. Xchar *termtyp;
  815. Xchar *tbufptr;
  816. X
  817. X    termtyp=getenv("TERM");
  818. X    switch(tgetent(tptr,termtyp)) {
  819. X    case -1:
  820. X        printf("Can't read termcap\n");
  821. X        exit(1);
  822. X    case 0:
  823. X        printf("Can't find your terminal type (%s) in termcap\n", termtyp);
  824. X        exit(1);
  825. X    }
  826. X    tbufptr=tbuf;
  827. X    AL = tgetstr("al", &tbufptr);
  828. X    BC = tgetstr("bc", &tbufptr);
  829. X    BL = tgetstr("bl", &tbufptr);
  830. X    if (!BL)
  831. X    BL = tgetstr("vb", &tbufptr);
  832. X    if (!BL)
  833. X    BL = "\007";
  834. X    BS = tgetflag("bs",&tbufptr);
  835. X    if (!BC && BS)
  836. X    BC = "\b";
  837. X    CB = tgetstr("cb", &tbufptr);
  838. X    CD = tgetstr("cd", &tbufptr);
  839. X    CL = tgetstr("cl", &tbufptr);
  840. X    CE = tgetstr("ce", &tbufptr);
  841. X    CM = tgetstr("cm", &tbufptr);
  842. X    CR = tgetstr("cr", &tbufptr);
  843. X    if (!CR)
  844. X    CR = "\r";
  845. X    CS = tgetstr("cs", &tbufptr);
  846. X    DC = tgetstr("dc", &tbufptr);
  847. X    DL = tgetstr("dl", &tbufptr);
  848. X    DO = tgetstr("do", &tbufptr);
  849. X    if (!DO)
  850. X    DO = "\n";
  851. X    EI = tgetstr("ei", &tbufptr);
  852. X    if (EI && !*EI)
  853. X    EI = NULL;
  854. X    IC = tgetstr("ic", &tbufptr);
  855. X    IM = tgetstr("im", &tbufptr);
  856. X    if (!tgetflag("mi") || tgetflag("in") || (IM && !*IM))
  857. X    IM = NULL;
  858. X    KE = tgetstr("ke", &tbufptr);
  859. X    KS = tgetstr("ks", &tbufptr);
  860. X    MB = tgetstr("mb", &tbufptr);    /* blink */
  861. X    MD = tgetstr("md", &tbufptr);    /* bold */
  862. X    ME = tgetstr("me", &tbufptr);    /* end all attributes */
  863. X    MR = tgetstr("mr", &tbufptr);    /* reverse-video */
  864. X    ND = tgetstr("nd", &tbufptr);
  865. X    NL = tgetstr("nl", &tbufptr);
  866. X    if (!NL)
  867. X    NL = "\n";
  868. X    SO = tgetstr("so", &tbufptr);
  869. X    SE = tgetstr("se", &tbufptr);
  870. X    /* should also test tgetflag("ms") -- safe to move while standout */
  871. X    if (tgetnum("sg") > 0 ||        /* attribute characters? */
  872. X    tgetflag("xs"))            /* standout not erased by overwrite */
  873. X       SO = SE = MB = MD = MR = NULL;
  874. X    SR = tgetstr("sr", &tbufptr);
  875. X    TI = tgetstr("ti", &tbufptr);
  876. X    TE = tgetstr("te", &tbufptr);
  877. X    UE = tgetstr("ue", &tbufptr);
  878. X    UP = tgetstr("up", &tbufptr);
  879. X    US = tgetstr("us", &tbufptr);
  880. X    if (tgetnum("ug") > 0)        /* garbage characters on US/UE */
  881. X    US = UE = 0;
  882. X    MAL = tgetstr("AL", &tbufptr);
  883. X    MDL = tgetstr("DL", &tbufptr);
  884. X    if ((CO = tgetnum("co")) == 0) CO = 80;
  885. X    if ((LI = tgetnum("li")) == 0) LI = 24;
  886. X    if (!TI) {
  887. X        TI = tgetstr("vs", &tbufptr);
  888. X        TE = tgetstr("ve", &tbufptr);
  889. X    }
  890. X
  891. X    if (CO < 80 || LI < 24) {
  892. X    printf("Sorry, but vtem requires 24 by 80 lines.\r\n");
  893. X    exit(1);
  894. X    }
  895. X    if (!CM || !UP) {
  896. X    printf("Sorry, but vtem requires cursor motion capabilities (cm,up,do,nd).\r\n");
  897. X    exit(1);
  898. X    }
  899. X    if (!CL || !CD) {
  900. X    printf("Sorry, but vtem requires clear screen capabilities (cl,cd).\r\n");
  901. X    exit(1);
  902. X    }
  903. X    if (!(CS && SR) && !(DL && AL))
  904. X    vttype = VT52;            /* no scrolling capabilities */
  905. X    else if (DC && (IC || (IM && EI)))
  906. X    vttype = VT102;            /* insert/delete char */
  907. X    else
  908. X    vttype = VT100;            /* normal */
  909. X}
  910. X
  911. Xsetupterm(flg)            /* If flg==TRUE, set line in cbreak mode and */
  912. XBool flg;            /* initialize the terminal,otherwise restore */
  913. X{
  914. X    if (flg) {
  915. X    ttycbreak();
  916. X    if (TI)
  917. X        tputs_x(TI);    /* start CM mode */
  918. X    }
  919. X    else {
  920. X    if (KE)
  921. X        tputs_x(KE);    /* Restores Keypad */
  922. X    if (TE)
  923. X        tputs_x(TE);    /* exit CM mode */
  924. X    ioctl(0, TIOCSETP, &oldb);
  925. X    ioctl(0, TIOCSETC, &oldtchars);
  926. X    ioctl(0, TIOCSLTC, &oldltchars);
  927. X    }
  928. X}
  929. X
  930. X/* clear_bos - clear from beginning of screen to cursor
  931. X * logical cursor is at (c,r) which may be past right edge of display
  932. X */
  933. Xclear_bos(c,r)
  934. Xint c,r;
  935. X{
  936. Xregister int i,j;
  937. X
  938. X    for (i=0; i<r; i++) {
  939. X    tputs_pad(tgoto(CM, 0, i),r);
  940. X    if (CE)
  941. X        tputs_x(CE);
  942. X    else {
  943. X        for (j=0; j < 80; j++)
  944. X        putchar(' ');
  945. X    }
  946. X    }
  947. X    clear_bol(c,r);
  948. X}
  949. X
  950. X/* clear_eos - Clear from cursor to end of screen.
  951. X */
  952. Xclear_eos()
  953. X{
  954. X    tputs_pad(CD,LI);
  955. X}
  956. X
  957. X/* clear_bol - Clear from beginning of line to cursor.
  958. X * logical cursor is at (c,r) which may be past right edge of display
  959. X */
  960. Xclear_bol(c,r)
  961. Xint c,r;
  962. X{
  963. Xregister int i;
  964. X
  965. X    if (CB) {
  966. X    tputs_x(CB);
  967. X    return;
  968. X    }
  969. X    tputs_x(tgoto(CM, 0, r));
  970. X    if (c >= CO-1) {
  971. X    cr();
  972. X    clear_eol(0,r);
  973. X    tputs_x(tgoto(CM, CO-1, r));
  974. X    } else {
  975. X    for (i=(r==LI-1)?c-1:c; i>=0; i--)
  976. X        putchar(' ');
  977. X    backspace();
  978. X    }
  979. X}
  980. X
  981. X/* clear_eol - Clear from cursor to end of line.
  982. X * logical cursor is at (c,r) which may be past right edge of display
  983. X */
  984. Xclear_eol(c, r)
  985. Xint c, r;
  986. X{
  987. Xregister int i;
  988. X
  989. X    if (CE)
  990. X    tputs_x(CE);
  991. X    else {
  992. X        if (c >= CO)
  993. X            return;
  994. X        for (i=(r==LI-1)?CO-c-1:CO-c; i>0; i--)
  995. X        putchar(' ');
  996. X    tputs_x(tgoto(CM, c, r));
  997. X    }
  998. X}
  999. X
  1000. X
  1001. Xcursor_up()
  1002. X{
  1003. X    tputs_x(UP); 
  1004. X}
  1005. X
  1006. X
  1007. Xcursor_down()
  1008. X{
  1009. X    tputs_x(DO); 
  1010. X}
  1011. X
  1012. X
  1013. Xcursor_right()
  1014. X{
  1015. X    tputs_x(ND); 
  1016. X}
  1017. X
  1018. X
  1019. Xreverse_lf()
  1020. X{
  1021. X    if (SR)
  1022. X    tputs_x(SR);        /* we hope.  May not move cursor. */
  1023. X    else
  1024. X    cursor_up();        /* We hope. May not scroll up properly! */
  1025. X}
  1026. X
  1027. X
  1028. X/* start_reverse - Set terminal in reverse video mode.
  1029. X */
  1030. Xstart_reverse()
  1031. X{
  1032. X    if (MR)
  1033. X    tputs_x(MR);
  1034. X    else
  1035. X    tputs_x(SO);
  1036. X}
  1037. X
  1038. X
  1039. Xstart_blink()
  1040. X{
  1041. X    tputs_x(MB);
  1042. X}
  1043. X
  1044. X
  1045. Xstart_underline()
  1046. X{
  1047. X    tputs_x(US);
  1048. X}
  1049. X
  1050. X
  1051. Xstart_bold()
  1052. X{
  1053. X    if (MD)
  1054. X    tputs_x(MD);
  1055. X    else
  1056. X    tputs_x(SO);
  1057. X}
  1058. X
  1059. X
  1060. Xring_bell()
  1061. X{
  1062. X    tputs_x(BL);
  1063. X}
  1064. X
  1065. X
  1066. X/* end_attributes - Reset terminal attributes to normal.
  1067. X */
  1068. Xend_attributes()
  1069. X{
  1070. X    if (ME)
  1071. X    tputs_x(ME);
  1072. X    else {
  1073. X    tputs_x(SE);
  1074. X    tputs_x(UE);
  1075. X    }
  1076. X}
  1077. X
  1078. X
  1079. Xscroll_region(lin1, lin2, upward)      /* Scroll region between lin1 and */
  1080. Xint lin1, lin2;                   /* lin2 inclusive one line up or down */
  1081. X{
  1082. X    /* Use scroll region if available - otherwise use insert/delete line*/
  1083. X    if (CS && SR) {
  1084. X    tputs_x(tgoto(CS,lin2,lin1));
  1085. X    if (upward) {
  1086. X        set_cursor(0,lin2);
  1087. X        tputs_x(NL);
  1088. X    }
  1089. X    else {
  1090. X        set_cursor(0,lin1);
  1091. X        tputs_x(SR);
  1092. X    }
  1093. X    tputs_x(tgoto(CS,23,0));
  1094. X    }
  1095. X    else if (DL && AL) {
  1096. X    if (upward) {
  1097. X        set_cursor(0,lin1);
  1098. X        tputs_pad(DL,LI-lin1);
  1099. X        set_cursor(0,lin2);
  1100. X        tputs_pad(AL,LI-lin2);
  1101. X    }
  1102. X    else {
  1103. X        set_cursor(0,lin2);
  1104. X        tputs_pad(DL,LI-lin2);
  1105. X        set_cursor(0,lin1);
  1106. X        tputs_pad(AL,LI-lin1);
  1107. X    }
  1108. X    }
  1109. X}
  1110. X
  1111. Xdelete_char()
  1112. X{
  1113. X    tputs_x(DC);
  1114. X}
  1115. X
  1116. X/*
  1117. X * register intention to start/end inserting
  1118. X * (must also call insert_char() before each character actually written)
  1119. X */
  1120. Xset_insert_mode(onoff)
  1121. XBool onoff;
  1122. X{
  1123. X    if (IM && EI) {
  1124. X    if (onoff)
  1125. X        tputs_x(IM);
  1126. X    else
  1127. X        tputs_x(EI);
  1128. X    }
  1129. X}
  1130. X
  1131. X
  1132. X/*
  1133. X * call to write any printing char while in insert mode
  1134. X * (must call insert_mode(1) to start and insert_mode(0) to end insert mode)
  1135. X */
  1136. Xinsert_char(ch)
  1137. Xchar ch;
  1138. X{
  1139. X    if (IC && (!IM || !EI))
  1140. X    tputs_x(IC);
  1141. X    putchar(ch);
  1142. X}
  1143. END_OF_FILE
  1144. if test 8436 -ne `wc -c <'samples/vt100/term.c'`; then
  1145.     echo shar: \"'samples/vt100/term.c'\" unpacked with wrong size!
  1146. fi
  1147. # end of 'samples/vt100/term.c'
  1148. fi
  1149. if test -f 'tooltool.c' -a "${1}" != "-c" ; then 
  1150.   echo shar: Will not clobber existing file \"'tooltool.c'\"
  1151. else
  1152. echo shar: Extracting \"'tooltool.c'\" \(6455 characters\)
  1153. sed "s/^X//" >'tooltool.c' <<'END_OF_FILE'
  1154. X/************************************************************************/
  1155. X/*    Copyright 1988 by Chuck Musciano and Harris Corporation        */
  1156. X/*                                    */
  1157. X/*    Permission to use, copy, modify, and distribute this software    */
  1158. X/*    and its documentation for any purpose and without fee is    */
  1159. X/*    hereby granted, provided that the above copyright notice    */
  1160. X/*    appear in all copies and that both that copyright notice and    */
  1161. X/*    this permission notice appear in supporting documentation, and    */
  1162. X/*    that the name of Chuck Musciano and Harris Corporation not be    */
  1163. X/*    used in advertising or publicity pertaining to distribution    */
  1164. X/*    of the software without specific, written prior permission.    */
  1165. X/*    Chuck Musciano and Harris Corporation make no representations    */
  1166. X/*    about the suitability of this software for any purpose.  It is    */
  1167. X/*    provided "as is" without express or implied warranty.        */
  1168. X/*                                    */
  1169. X/*    The sale of any product based wholely or in part upon the     */
  1170. X/*    technology provided by tooltool is strictly forbidden without    */
  1171. X/*    specific, prior written permission from Harris Corporation.    */
  1172. X/*    Tooltool technology includes, but is not limited to, the source    */
  1173. X/*    code, executable binary files, specification language, and    */
  1174. X/*    sample specification files.                    */
  1175. X/************************************************************************/
  1176. X
  1177. X
  1178. X#include    <stdio.h>
  1179. X#include    <ctype.h>
  1180. X
  1181. X#include    <sys/file.h>
  1182. X
  1183. X#include    "tooltool.h"
  1184. X
  1185. XEXPORT    a_ptr    tt_initial_action = NULL,
  1186. X        tt_timer_action = NULL,
  1187. X        tt_func_keys[MAX_KEY_SETS][MAX_FUNC_KEYS][MAX_SHIFT_SETS];
  1188. X
  1189. XEXPORT    char    *tt_application = NULL,
  1190. X        *tt_curr_file = "stdin",
  1191. X        *tt_icon = NULL,
  1192. X        *tt_program;
  1193. X
  1194. XEXPORT    d_ptr    tt_base_window = NULL;
  1195. X
  1196. XEXPORT    int    tt_mouse_base = 0,
  1197. X        tt_mouse_chars = TRUE,
  1198. X        tt_errors_occured = 0,
  1199. X        tt_normal_off = FALSE,
  1200. X        tt_function_off = FALSE,
  1201. X        tt_action_depth = 0,
  1202. X        tt_timer_pending = FALSE;
  1203. X
  1204. XEXPORT    l_ptr    tt_default_mark,
  1205. X        tt_default_nomark,
  1206. X        tt_default_cycle;
  1207. X
  1208. XEXPORT    m_data    tt_mouse[MAX_MOUSE_BUTTONS][MAX_SHIFT_SETS];
  1209. X
  1210. XEXPORT    Menu    tt_ttymenu = NULL;
  1211. X
  1212. XEXPORT    struct    pixfont    *tt_default_font = NULL,
  1213. X            *tt_a_font = NULL;
  1214. X
  1215. XEXPORT    s_ptr    tt_mouse_x,
  1216. X        tt_mouse_y,
  1217. X        tt_delimiters;
  1218. X
  1219. XPRIVATE    short    mark_bits[] = {0x07C0,0x1830,0x2008,0x4384,0x4FE4,0x8FE2,0x9FF2,0x9FF2,
  1220. X                   0x9FF2,0x8FE2,0x4FE4,0x4384,0x2008,0x1830,0x07C0,0x0000};
  1221. Xmpr_static(tt_mark_image, 15, 15, 1, mark_bits);
  1222. X
  1223. XPRIVATE    short    nomark_bits[] = {0x07C0,0x1830,0x2008,0x4004,0x4004,0x8002,0x8002,0x8002,
  1224. X                 0x8002,0x8002,0x4004,0x4004,0x2008,0x1830,0x07C0,0x0000};
  1225. Xmpr_static(tt_nomark_image, 15, 15, 1, nomark_bits);
  1226. X
  1227. XPRIVATE    short    cycle_bits[] = {0x07C0,0x0FE0,0x1834,0x301C,0x601C,0x203C,0x0000,0x0000,
  1228. X                0x7808,0x700C,0x7018,0x5830,0x0FE0,0x07C0,0x0000,0x0000};
  1229. Xmpr_static(tt_cycle_image, 16, 16, 1, cycle_bits);
  1230. X
  1231. X/************************************************************************/
  1232. X/* The main driver parses the specification file, builds the window,    */
  1233. X/* and starts up suntools to execute the user application.        */
  1234. X/************************************************************************/
  1235. X
  1236. X/************************************************************************/
  1237. XPRIVATE    check_args(argc, argv, n1, n2, v1, v2)
  1238. X
  1239. Xint    *argc;
  1240. Xchar    **argv;
  1241. Xchar    *n1;
  1242. Xchar    *n2;
  1243. Xint    *v1;
  1244. Xint    *v2;
  1245. X
  1246. X{    int    i, j;
  1247. X
  1248. X    for (i = 1; i < *argc; i++)
  1249. X       if (strcmp(argv[i], n1) == 0 || strcmp(argv[i], n2) == 0) {
  1250. X          if (i + 1 < *argc)
  1251. X             *v1 = atoi(argv[i + 1]);
  1252. X          else
  1253. X             abend("missing argument after %s", argv[i]);
  1254. X          if (v2)
  1255. X             if (i + 2 < *argc)
  1256. X                *v2 = atoi(argv[i + 2]);
  1257. X             else
  1258. X                abend("missing argument after %s", argv[i]);
  1259. X          for (j = i + (v2? 3 : 2); j < *argc; j++, i++)
  1260. X             argv[i] = argv[j];
  1261. X          *argc -= (v2? 3 : 2);
  1262. X          argv[*argc] = NULL;
  1263. X          break;
  1264. X          }
  1265. X}
  1266. X
  1267. X/************************************************************************/
  1268. Xmain(argc, argv)
  1269. X
  1270. Xint    argc;
  1271. Xchar    **argv;
  1272. X
  1273. X{    int    i, j, k;
  1274. X    int    force_height = -1, force_width = -1, force_rows = -1, force_cols = -1;
  1275. X
  1276. X    tt_program = strsave(argv[0]);
  1277. X
  1278. X    if (argc > 1 && strcmp(argv[1], POLLING_MAGIC_NUMBER) == 0) { /* is this a gross hack, or what? */
  1279. X       wait_for_window_size(atoi(argv[2]), atoi(argv[3]), POLLING_TIME_OUT);
  1280. X       execv(tt_full_path_of(argv[4], X_OK), &(argv[4]));
  1281. X       fprintf(stderr, "could not exec %s\n", argv[4]);
  1282. X       sleep(20);
  1283. X       exit(1);
  1284. X       }
  1285. X
  1286. X    for (i = LEFT_KEY_SET; i < MAX_KEY_SETS; i++)
  1287. X       for (j = 0; j < MAX_FUNC_KEYS; j++)
  1288. X          for (k = 0; k < MAX_SHIFT_SETS; k++)
  1289. X             tt_func_keys[i][j][k] = NULL;
  1290. X    for (i = MOUSE_LEFT; i < MAX_MOUSE_BUTTONS; i++)
  1291. X       for (j = 0; j < MAX_SHIFT_SETS; j++)
  1292. X          tt_mouse[i][j].defined = MOUSE_UNDEFINED;
  1293. X
  1294. X    if (argc >= 3 && strcmp(argv[1], "-f") == 0) {
  1295. X       if (freopen(tt_full_path_of(argv[2], R_OK), "r", stdin) == NULL)
  1296. X          abend("could not read %s", argv[2]);
  1297. X       else {
  1298. X          tt_curr_file = argv[2];
  1299. X          for (i = 3; i < argc; i++)
  1300. X             argv[i - 2] = argv[i];
  1301. X          argc -= 2;
  1302. X          }
  1303. X       }
  1304. X    check_args(&argc, argv, "-Ww", "-width", &force_cols, NULL);
  1305. X    check_args(&argc, argv, "-Wh", "-height", &force_rows, NULL);
  1306. X    check_args(&argc, argv, "-Ws", "-size", &force_width, &force_height);
  1307. X
  1308. X    tt_default_font = pf_default();
  1309. X    tt_default_mark = tt_make_label(FALSE, NULL, NULL, &tt_mark_image);
  1310. X    tt_default_nomark = tt_make_label(FALSE, NULL, NULL, &tt_nomark_image);
  1311. X    tt_default_cycle = tt_make_label(FALSE, NULL, NULL, &tt_cycle_image);
  1312. X    tt_a_font = tt_default_font;
  1313. X    tt_base_window = tt_make_base_window();
  1314. X    tt_make_intrinsic_symbols();
  1315. X    yyparse();
  1316. X    if (tt_errors_occured)
  1317. X       abend("%d errors.", tt_errors_occured);
  1318. X    if (force_height != -1)
  1319. X       if (force_rows != -1 || force_cols != -1)
  1320. X          abend("conflict between window size command line options");
  1321. X       else {
  1322. X          tt_base_window->is_chars = FALSE;
  1323. X          tt_base_window->rows = force_height;
  1324. X          tt_base_window->columns = force_width;
  1325. X          }
  1326. X    else {
  1327. X       if (force_rows != -1)
  1328. X          if (tt_base_window->is_chars)
  1329. X             tt_base_window->rows = force_rows;
  1330. X          else
  1331. X             tt_base_window->rows = force_rows * charheight_of(tt_a_font);
  1332. X       if (force_cols != -1)
  1333. X          if (tt_base_window->is_chars)
  1334. X             tt_base_window->columns = force_cols;
  1335. X          else
  1336. X             tt_base_window->columns = force_cols * charwidth_of(tt_a_font);
  1337. X       }
  1338. X    if (tt_base_window->g_align == NO_ALIGN)
  1339. X       tt_base_window->g_align = ALIGN_TOP;
  1340. X    build_window(argc, argv);
  1341. X    window_main_loop(tt_base_window->frame);
  1342. X    exit(0);
  1343. X}
  1344. END_OF_FILE
  1345. if test 6455 -ne `wc -c <'tooltool.c'`; then
  1346.     echo shar: \"'tooltool.c'\" unpacked with wrong size!
  1347. fi
  1348. # end of 'tooltool.c'
  1349. fi
  1350. echo shar: End of archive 3 \(of 13\).
  1351. cp /dev/null ark3isdone
  1352. MISSING=""
  1353. for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 ; do
  1354.     if test ! -f ark${I}isdone ; then
  1355.     MISSING="${MISSING} ${I}"
  1356.     fi
  1357. done
  1358. if test "${MISSING}" = "" ; then
  1359.     echo You have unpacked all 13 archives.
  1360.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  1361. else
  1362.     echo You still need to unpack the following archives:
  1363.     echo "        " ${MISSING}
  1364. fi
  1365. ##  End of shell archive.
  1366. exit 0
  1367.  
  1368.  
  1369. Chuck Musciano            ARPA  : chuck@trantor.harris-atd.com
  1370. Harris Corporation         Usenet: ...!uunet!x102a!trantor!chuck
  1371. PO Box 37, MS 3A/1912        AT&T  : (407) 727-6131
  1372. Melbourne, FL 32902        FAX   : (407) 727-{5118,5227,4004}
  1373.